#+TITLE: Anything GUI related should go here
#+AUTHOR:Joshua Branson
#+LATEX_HEADER: \usepackage{lmodern}
#+LATEX_HEADER: \usepackage[QX]{fontenc}

* Don't show the tool bar.  It's a waste of space
:PROPERTIES:
:ID:       76aeb58d-4a8b-4f1b-b0df-cf860a2c38c6
:END:
#+BEGIN_SRC emacs-lisp
(when (fboundp 'tool-bar-mode)
  (tool-bar-mode -1))
#+END_SRC

* windmove
:PROPERTIES:
:ID:       124ab2a5-dfbe-4399-af27-4958f163537a
:END:

(use-package windmove )

Windmove makes it easy to move point to a different buffer, especially when the window displays more than 1 buffer.

This might be a good thing for a hydra here.

Windmove doesn't have a toggle window split.  I found this command online.
#+BEGIN_SRC emacs-lisp
(defun my/toggle-window-split ()
  (interactive)
  (if (= (count-windows) 2)
      (let* ((this-win-buffer (window-buffer))
             (next-win-buffer (window-buffer (next-window)))
             (this-win-edges (window-edges (selected-window)))
             (next-win-edges (window-edges (next-window)))
             (this-win-2nd (not (and (<= (car this-win-edges)
                                         (car next-win-edges))
                                     (<= (cadr this-win-edges)
                                         (cadr next-win-edges)))))
             (splitter
              (if (= (car this-win-edges)
                     (car (window-edges (next-window))))
                  'split-window-horizontally
                'split-window-vertically)))
        (delete-other-windows)
        (let ((first-win (selected-window)))
          (funcall splitter)
          (if this-win-2nd (other-window 1))
          (set-window-buffer (selected-window) this-win-buffer)
          (set-window-buffer (next-window) next-win-buffer)
          (select-window first-win)
          (if this-win-2nd (other-window 1))))))

#+END_SRC

I think that some of these commands are not needed.
#+BEGIN_SRC emacs-lisp

  (with-eval-after-load 'evil
    (define-key evil-emacs-state-map (kbd "C-w h") 'windmove-down)
    (define-key evil-emacs-state-map (kbd "C-w t") 'windmove-up)
    (define-key evil-emacs-state-map (kbd "C-w n") 'windmove-left)
    (define-key evil-emacs-state-map (kbd "C-w s") 'windmove-right)
    (define-key evil-emacs-state-map (kbd "C-w C-t") 'my/toggle-window-split)

    (define-key evil-window-map (kbd "C-t") 'my/toggle-window-split)
    (define-key evil-emacs-state-map (kbd "C-w C-t") 'my/toggle-window-split)

    (evil-define-key 'emacs evil-normal-state-map (kbd "C-w h") 'windmove-down)
    (evil-define-key 'emacs evil-normal-state-map (kbd "C-w t") 'windmove-up)
    (evil-define-key 'emacs evil-normal-state-map (kbd "C-w n") 'windmove-left)
    (evil-define-key 'emacs evil-normal-state-map (kbd "C-w s") 'windmove-ri)
    (evil-define-key 'emacs evil-normal-state-map (kbd "C-w C-t") 'my/toggle-window-split)

    ;;I don't think this would ever really be useful
    (evil-define-key 'normal help-mode-map (kbd "C-w h") 'windmove-down)
    (evil-define-key 'normal help-mode-map (kbd "C-w t") 'windmove-up)
    (evil-define-key 'normal help-mode-map (kbd "C-w n") 'windmove-left)
    (evil-define-key 'normal help-mode-map (kbd "C-w s") 'windmove-right)
    (evil-define-key 'normal help-mode-map (kbd "C-w C-t") 'my/toggle-window-split)

    (evil-define-key 'emacs  help-mode-map (kbd "C-w h") 'windmove-down)
    (evil-define-key 'emacs  help-mode-map (kbd "C-w t") 'windmove-up)
    (evil-define-key 'emacs  help-mode-map (kbd "C-w n") 'windmove-left)
    (evil-define-key 'emacs  help-mode-map (kbd "C-w s") 'windmove-right)
    (evil-define-key 'emacs  help-mode-map (kbd "C-w C-t") 'my/toggle-window-split)

    (evil-define-key 'normal debugger-mode-map (kbd "C-w h") 'windmove-down)
    (evil-define-key 'normal debugger-mode-map (kbd "C-w t") 'windmove-up)
    (evil-define-key 'normal debugger-mode-map (kbd "C-w n") 'windmove-left)
    (evil-define-key 'normal debugger-mode-map (kbd "C-w s") 'windmove-right)
    (evil-define-key 'normal debugger-mode-map (kbd "C-w C-t") 'my/toggle-window-split)

    (evil-define-key 'emacs  debugger-mode-map (kbd "C-w h") 'windmove-down)
    (evil-define-key 'emacs  debugger-mode-map (kbd "C-w t") 'windmove-up)
    (evil-define-key 'emacs  debugger-mode-map (kbd "C-w n") 'windmove-left)
    (evil-define-key 'emacs  debugger-mode-map (kbd "C-w s") 'windmove-right)
    (evil-define-key 'emacs  debugger-mode-map (kbd "C-w C-t") 'my/toggle-window-split)

    (evil-define-key 'emacs  erc-mode-map (kbd "C-w h") 'windmove-down)
    (evil-define-key 'emacs  erc-mode-map (kbd "C-w t") 'windmove-up)
    (evil-define-key 'emacs  erc-mode-map (kbd "C-w n") 'windmove-left)
    (evil-define-key 'emacs  erc-mode-map (kbd "C-w s") 'windmove-right)
    (evil-define-key 'emacs  erc-mode-map (kbd "C-w C-t") 'my/toggle-window-split)

    (evil-define-key 'emacs  gnus-article-mode-map (kbd "C-w h") 'windmove-down)
    (evil-define-key 'emacs  gnus-article-mode-map (kbd "C-w t") 'windmove-up)
    (evil-define-key 'emacs  gnus-article-mode-map (kbd "C-w n") 'windmove-left)
    (evil-define-key 'emacs  gnus-article-mode-map (kbd "C-w s") 'windmove-right)
    (evil-define-key 'emacs  gnus-article-mode-map (kbd "C-w C-t") 'my/toggle-window-split))

#+END_SRC


This lets you use the windmove commands inside an info buffer!!!! sooo cool!
  #+BEGIN_SRC emacs-lisp
    (with-eval-after-load 'info
      (define-key Info-mode-map (kbd "C-w h") 'windmove-down)
      (define-key Info-mode-map (kbd "C-w t") 'windmove-up)
      (define-key Info-mode-map (kbd "C-w n") 'windmove-left)
      (define-key Info-mode-map (kbd "C-w s") 'windmove-right))
  #+END_SRC

* improving the mouse experience
:PROPERTIES:
:ID:       4b82a889-e8a4-40de-bacd-7f772003b886
:END:
scroll one line at a time (less "jumpy" than defaults)
this lets you scroll the emacs buffer rather smoothly
#+BEGIN_SRC emacs-lisp
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
(setq scroll-step 1) ;; keyboard scroll one line at a time
#+END_SRC

* Open Emacs up like you had it last.
  :PROPERTIES:
  :ID:       720c6d6c-91f8-4894-8072-dcd4d9ffb543
  :END:
This is SOOO useful!  Not really.  It conflicts with me wanting to open my org calendar...

Use the desktop library to save the state of Emacs from one session to another. Once you save the Emacs desktop—the buffers,
their file names, major modes, buffer positions, and so on—then subsequent Emacs sessions reload the saved desktop. By default,
the desktop also tries to save the frame and window configuration. To disable this, set desktop-restore-frames to nil. (See that
variable’s documentation for some related options that you can customize to fine-tune this behavior.)

#+BEGIN_SRC emacs-lisp
(desktop-save-mode 1)
#+END_SRC

* Save the position point was in
:PROPERTIES:
:ID:       d134e7d8-0081-45df-b9ef-e94725e39177
:END:

http://whattheemacsd.com/init.el-03.html
Save the position that point was in during the last emacs session
#+BEGIN_SRC emacs-lisp
(setq save-place-file (expand-file-name ".places" user-emacs-directory))
(save-place-mode)
#+END_SRC

* Highlight cursor's line
:PROPERTIES:
:ID:       872d67fc-8bc5-4295-8664-64d0ea432606
:END:
show a nice highlight where-ever your cursor is
but ONLY on graphical displays.  It looks weird in the terminal
#+BEGIN_SRC emacs-lisp
  (defun my/turn-on-hl-line-mode ()
    "This will turn on hl-line mode."
    (interactive)
    (when (display-graphic-p)
      (add-hook 'prog-mode-hook 'hl-line-mode)
      (add-hook 'text-mode-hook 'hl-line-mode)))

  (add-hook 'after-init-hook 'my/turn-on-hl-line-mode)
#+END_SRC

* color various comments
:PROPERTIES:
:ID:       8e3718b8-0b55-4e8e-833c-179b249119d3
:END:
make comments in most programming languages various colors. [[file:~/.bashrc::#x%20hello]]

#+BEGIN_SRC emacs-lisp
  ;;cr red
  ;;cg green
  ;;x like this
  (defface font-lock-comment-strike
    '((t (:strike-through t)))
    "For strike-through comments")

  (defface font-lock-comment-important
    '((t (:foreground "#00ff00")))
    "For important")

  (defface font-lock-comment-todo
    '((t (:foreground "#ff0000")))
    "For todo comments")

(defun add-custom-keyw ()
  "adds a few special keywords"
  (font-lock-add-keywords
   nil
   '(("\\s<+x[[:space:]]*\\(.*?\\)[[:space:]]*\\s>" 1 'font-lock-comment-strike prepend)
     ("\\s<+cr[[:space:]]*\\(.*?\\)[[:space:]]*\\s>" 1 'font-lock-comment-todo prepend)
     ("\\s<+cg[[:space:]]*\\(.*?\\)[[:space:]]*\\s>" 1 'font-lock-comment-important prepend))))

    (add-hook 'prog-mode-hook #'add-custom-keyw)


#+END_SRC

* Provide this file
:PROPERTIES:
:ID:       09c1f6fc-7c51-4de1-93d5-8870dc929c25
:END:
#+BEGIN_SRC emacs-lisp
  (provide 'init-gui-frames)
#+END_SRC
